#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    FILE* fp=fopen("bit.txt","w+");//打开文件
    if(fp==NULL)
    {
        perror("fopen");
        exit(1);
    }
    char msg[]="linux so easy!\n";
    int len=strlen(msg);
    int cnt=5;
    while(cnt--)
    {
        fwrite(msg,len,1,fp);//写入
    }
    fseek(fp,0,SEEK_SET);//指针回到起始位置
    char buf[128];
    while(1)
    {
        ssize_t s=fread(buf,1,len,fp);
        if(s>0)
        {
            buf[s]=0;
            fwrite(buf,len+1,1,stdout);
        }
        else
            break;
    }
    fclose(fp);
    return 0;
}
